<!--
 * @Descripttion: 
 * @Author: YuZhenJing
 * @Date: 2020-06-20 11:24:37
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-06-20 11:27:51
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="content">anyun.com</div>
    <script>
      let con = prompt("请输入要检测的内容，支持正则");
      let reg = new RegExp(con, "g");
      let div = document.querySelector("div");
      div.innerHTML = div.innerHTML.replace(reg, (search) => {
        return `<span style="color:red">${search}</span>`;
      });
    </script>
  </body>
</html>
